from base import build_driver
from scenario.zentao_biz import get_real_name_with_login

browser = build_driver("http://biz.demo.zentao.net/user-login.html", "c")

browser.type("account", "demo")
browser.type("x, //*[@id='loginPanel']/div/div[2]/form/table/tbody/tr[2]/td/input", "123456")
browser.click("s, #submit")

assert "my/" in browser.get_url(), "登录后 URL 跳转失败! "

browser.quit()

browser = build_driver("http://biz.demo.zentao.net/user-login.html", "hc")
actual_real_name = get_real_name_with_login(
    driver=browser,
    account="demo",
    password="123456"
)

print(actual_real_name)
